// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*!
 * @file obstacle_distance.cpp
 * This source file contains the definition of the described types in the IDL file.
 *
 * This file was generated by the tool gen.
 */

#ifdef _WIN32
// Remove linker warning LNK4221 on Visual Studio
namespace { char dummy; }
#endif

#include "obstacle_distance.h"
#include <fastcdr/Cdr.h>

#include <fastcdr/exceptions/BadParamException.h>
using namespace eprosima::fastcdr::exception;

#include <utility>









obstacle_distance::obstacle_distance()
{
    // m_timestamp_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@5bfbf16f
    m_timestamp_ = 0;
    // m_frame_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@25af5db5
    m_frame_ = 0;
    // m_sensor_type_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@12cdcf4
    m_sensor_type_ = 0;
    // m_distances com.eprosima.idl.parser.typecode.AliasTypeCode@5bcea91b
    memset(&m_distances, 0, (72) * 2);
    // m_increment_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@5f3a4b84
    m_increment_ = 0.0;
    // m_min_distance_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@27f723
    m_min_distance_ = 0;
    // m_max_distance_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@670b40af
    m_max_distance_ = 0;
    // m_angle_offset_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@4923ab24
    m_angle_offset_ = 0.0;

}

obstacle_distance::~obstacle_distance()
{








}

obstacle_distance::obstacle_distance(const obstacle_distance &x)
{
    m_timestamp_ = x.m_timestamp_;
    m_frame_ = x.m_frame_;
    m_sensor_type_ = x.m_sensor_type_;
    m_distances = x.m_distances;
    m_increment_ = x.m_increment_;
    m_min_distance_ = x.m_min_distance_;
    m_max_distance_ = x.m_max_distance_;
    m_angle_offset_ = x.m_angle_offset_;
}

obstacle_distance::obstacle_distance(obstacle_distance &&x)
{
    m_timestamp_ = x.m_timestamp_;
    m_frame_ = x.m_frame_;
    m_sensor_type_ = x.m_sensor_type_;
    m_distances = std::move(x.m_distances);
    m_increment_ = x.m_increment_;
    m_min_distance_ = x.m_min_distance_;
    m_max_distance_ = x.m_max_distance_;
    m_angle_offset_ = x.m_angle_offset_;
}

obstacle_distance& obstacle_distance::operator=(const obstacle_distance &x)
{

    m_timestamp_ = x.m_timestamp_;
    m_frame_ = x.m_frame_;
    m_sensor_type_ = x.m_sensor_type_;
    m_distances = x.m_distances;
    m_increment_ = x.m_increment_;
    m_min_distance_ = x.m_min_distance_;
    m_max_distance_ = x.m_max_distance_;
    m_angle_offset_ = x.m_angle_offset_;

    return *this;
}

obstacle_distance& obstacle_distance::operator=(obstacle_distance &&x)
{

    m_timestamp_ = x.m_timestamp_;
    m_frame_ = x.m_frame_;
    m_sensor_type_ = x.m_sensor_type_;
    m_distances = std::move(x.m_distances);
    m_increment_ = x.m_increment_;
    m_min_distance_ = x.m_min_distance_;
    m_max_distance_ = x.m_max_distance_;
    m_angle_offset_ = x.m_angle_offset_;

    return *this;
}

size_t obstacle_distance::getMaxCdrSerializedSize(size_t current_alignment)
{
    size_t initial_alignment = current_alignment;


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);


    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);


    current_alignment += ((72) * 2) + eprosima::fastcdr::Cdr::alignment(current_alignment, 2);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 2 + eprosima::fastcdr::Cdr::alignment(current_alignment, 2);


    current_alignment += 2 + eprosima::fastcdr::Cdr::alignment(current_alignment, 2);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);



    return current_alignment - initial_alignment;
}

size_t obstacle_distance::getCdrSerializedSize(const obstacle_distance& data, size_t current_alignment)
{
    (void)data;
    size_t initial_alignment = current_alignment;


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);


    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);


    if ((72) > 0)
    {
        current_alignment += ((72) * 2) + eprosima::fastcdr::Cdr::alignment(current_alignment, 2);
    }

    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 2 + eprosima::fastcdr::Cdr::alignment(current_alignment, 2);


    current_alignment += 2 + eprosima::fastcdr::Cdr::alignment(current_alignment, 2);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);



    return current_alignment - initial_alignment;
}

void obstacle_distance::serialize(eprosima::fastcdr::Cdr &scdr) const
{

    scdr << m_timestamp_;
    scdr << m_frame_;
    scdr << m_sensor_type_;
    scdr << m_distances;

    scdr << m_increment_;
    scdr << m_min_distance_;
    scdr << m_max_distance_;
    scdr << m_angle_offset_;
}

void obstacle_distance::deserialize(eprosima::fastcdr::Cdr &dcdr)
{

    dcdr >> m_timestamp_;
    dcdr >> m_frame_;
    dcdr >> m_sensor_type_;
    dcdr >> m_distances;

    dcdr >> m_increment_;
    dcdr >> m_min_distance_;
    dcdr >> m_max_distance_;
    dcdr >> m_angle_offset_;
}

/*!
 * @brief This function sets a value in member timestamp_
 * @param _timestamp_ New value for member timestamp_
 */
void obstacle_distance::timestamp_(uint64_t _timestamp_)
{
m_timestamp_ = _timestamp_;
}

/*!
 * @brief This function returns the value of member timestamp_
 * @return Value of member timestamp_
 */
uint64_t obstacle_distance::timestamp_() const
{
    return m_timestamp_;
}

/*!
 * @brief This function returns a reference to member timestamp_
 * @return Reference to member timestamp_
 */
uint64_t& obstacle_distance::timestamp_()
{
    return m_timestamp_;
}

/*!
 * @brief This function sets a value in member frame_
 * @param _frame_ New value for member frame_
 */
void obstacle_distance::frame_(uint8_t _frame_)
{
m_frame_ = _frame_;
}

/*!
 * @brief This function returns the value of member frame_
 * @return Value of member frame_
 */
uint8_t obstacle_distance::frame_() const
{
    return m_frame_;
}

/*!
 * @brief This function returns a reference to member frame_
 * @return Reference to member frame_
 */
uint8_t& obstacle_distance::frame_()
{
    return m_frame_;
}

/*!
 * @brief This function sets a value in member sensor_type_
 * @param _sensor_type_ New value for member sensor_type_
 */
void obstacle_distance::sensor_type_(uint8_t _sensor_type_)
{
m_sensor_type_ = _sensor_type_;
}

/*!
 * @brief This function returns the value of member sensor_type_
 * @return Value of member sensor_type_
 */
uint8_t obstacle_distance::sensor_type_() const
{
    return m_sensor_type_;
}

/*!
 * @brief This function returns a reference to member sensor_type_
 * @return Reference to member sensor_type_
 */
uint8_t& obstacle_distance::sensor_type_()
{
    return m_sensor_type_;
}

/*!
 * @brief This function copies the value in member distances
 * @param _distances New value to be copied in member distances
 */
void obstacle_distance::distances(const obstacle_distance__unsigned_short_array_72 &_distances)
{
m_distances = _distances;
}

/*!
 * @brief This function moves the value in member distances
 * @param _distances New value to be moved in member distances
 */
void obstacle_distance::distances(obstacle_distance__unsigned_short_array_72 &&_distances)
{
m_distances = std::move(_distances);
}

/*!
 * @brief This function returns a constant reference to member distances
 * @return Constant reference to member distances
 */
const obstacle_distance__unsigned_short_array_72& obstacle_distance::distances() const
{
    return m_distances;
}

/*!
 * @brief This function returns a reference to member distances
 * @return Reference to member distances
 */
obstacle_distance__unsigned_short_array_72& obstacle_distance::distances()
{
    return m_distances;
}
/*!
 * @brief This function sets a value in member increment_
 * @param _increment_ New value for member increment_
 */
void obstacle_distance::increment_(float _increment_)
{
m_increment_ = _increment_;
}

/*!
 * @brief This function returns the value of member increment_
 * @return Value of member increment_
 */
float obstacle_distance::increment_() const
{
    return m_increment_;
}

/*!
 * @brief This function returns a reference to member increment_
 * @return Reference to member increment_
 */
float& obstacle_distance::increment_()
{
    return m_increment_;
}

/*!
 * @brief This function sets a value in member min_distance_
 * @param _min_distance_ New value for member min_distance_
 */
void obstacle_distance::min_distance_(uint16_t _min_distance_)
{
m_min_distance_ = _min_distance_;
}

/*!
 * @brief This function returns the value of member min_distance_
 * @return Value of member min_distance_
 */
uint16_t obstacle_distance::min_distance_() const
{
    return m_min_distance_;
}

/*!
 * @brief This function returns a reference to member min_distance_
 * @return Reference to member min_distance_
 */
uint16_t& obstacle_distance::min_distance_()
{
    return m_min_distance_;
}

/*!
 * @brief This function sets a value in member max_distance_
 * @param _max_distance_ New value for member max_distance_
 */
void obstacle_distance::max_distance_(uint16_t _max_distance_)
{
m_max_distance_ = _max_distance_;
}

/*!
 * @brief This function returns the value of member max_distance_
 * @return Value of member max_distance_
 */
uint16_t obstacle_distance::max_distance_() const
{
    return m_max_distance_;
}

/*!
 * @brief This function returns a reference to member max_distance_
 * @return Reference to member max_distance_
 */
uint16_t& obstacle_distance::max_distance_()
{
    return m_max_distance_;
}

/*!
 * @brief This function sets a value in member angle_offset_
 * @param _angle_offset_ New value for member angle_offset_
 */
void obstacle_distance::angle_offset_(float _angle_offset_)
{
m_angle_offset_ = _angle_offset_;
}

/*!
 * @brief This function returns the value of member angle_offset_
 * @return Value of member angle_offset_
 */
float obstacle_distance::angle_offset_() const
{
    return m_angle_offset_;
}

/*!
 * @brief This function returns a reference to member angle_offset_
 * @return Reference to member angle_offset_
 */
float& obstacle_distance::angle_offset_()
{
    return m_angle_offset_;
}


size_t obstacle_distance::getKeyMaxCdrSerializedSize(size_t current_alignment)
{
    size_t current_align = current_alignment;











    return current_align;
}

bool obstacle_distance::isKeyDefined()
{
   return false;
}

void obstacle_distance::serializeKey(eprosima::fastcdr::Cdr &scdr) const
{
    (void) scdr;
     
     
     
     
     
     
     
     
}
